//渲染详情页页面
function renderDetailPage(){
    let dataDetial = JSON.parse(localStorage.getItem("detailData"));
    let htmlTitle = `
                        <span class="project-name">${dataDetial.project_name}</span>
                    `;
    let count = 0;
    let carts = localStorage.getItem("cartsData");
    carts = JSON.parse(carts);
    if(carts == null){
        count = 0;
    }else{
        if(carts.length == 0){
            count = 0;
        }else{
            carts.forEach(item => {
                if(item.id == dataDetial.id){
                    count = item.count;
                }
            });
        }
    }
    
    let html = `
                <div class="detail-img-icon no_pic" style="background-image: url(&quot;${dataDetial.cover}&quot;);"></div> 
                <div class="detail-info-wrapper">
                    <div class="product-info-name">${dataDetial.project_name}</div> 
                    <div class="product-info-time-wrapper">
                        <div class="product-info-time-title">时间：</div> 
                        <div class="product-info-time">${dataDetial.tlabel}</div>
                    </div> 
                    <div class="vuene-wrapper">
                        <div class="title">场馆：</div> 
                        <div class="vuene-info-content">
                            <div class="vuene-name">${dataDetial.venue_name}</div> 
                            <div class="address-name">${dataDetial.venue_name}</div> 
                            <div class="address-icon fa fa-map-marker"></div> 
                            <div class="check-map">查看地图</div>
                        </div>
                    </div> 
                    <div class="login-show-wrapper">
                        <ul class="clearfix mr4">
                            <li class="title">场次：</li> 
                            <li class="screens">
                                <div class="selectable-option active">${dataDetial.tlabel}</div>
                            </li>
                        </ul> 
                        <ul class="clearfix">
                            <li class="title">价格：</li> 
                            <li class="tickets">
                                <div class="selectable-option active">${(dataDetial.price_low/100).toFixed(2)}(单日预售票)</div>
                            </li>
                        </ul> 
                        <ul class="clearfix">
                            <li class="title">数量：</li> 
                            <li class="num-content">
                                <div class="ticket-count">
                                    <div class="count-reduce">-</div> 
                                    <div class="count-number">${count}</div> 
                                    <div class="count-plus active">+</div>
                                </div>
                            </li>
                        </ul>
                        <div class="product-buy-wrapper">
                            <div class="product-buy enable">
                                <div>立即购票</div>
                            </div>
                            <div class="product-buy enable carts">
                                <div>加入购物车</div>
                            </div>
                        </div>
                    </div>
                </div>
                `;
    $(".buyticket .bread-wrapper").append(htmlTitle);
    $(".whole-detail-info-wrapper").html(html);

    if(count != 0){
        $(".ticket-count .count-reduce").addClass("active");
    }
}
renderDetailPage()
